package gov.nasa.anml.lifted;

import gov.nasa.anml.PDDL;
import gov.nasa.anml.State;
import gov.nasa.anml.PDDL.Action;
import gov.nasa.anml.PDDL.Time;
import gov.nasa.anml.utility.*;

// if an effect, then definite time.  If indefinite time, then a condition.
// maybe should split?
// Kind of like "actions are a set of timed statements, qualified by
// a set of timed conditions"
// semantics are not p => e -- rather
// semantics are that e always happens, but not(p) => fail
// i.e., (s':=do(a,s)) => s'==do(e,s) ^ holds(p,s')
// which could contradict or be self-supporting
// seeing as how the conditions (p) are _timed_, however, it could easily
// be the case that holds(p,s') iff holds(p',s), where p' are a set of
// untimed statements (preconditions, if that is what p happens to be)
// expressions, in general, would be of this latter kind -- because
// they are used to determine the effects that happen the determinization
// of the expression's value has to be independent of the dependent effects.
//
// this makes things complicated.
//

public class TimedStatement extends IntervalImp implements Statement {
	public Statement s;

	public TimedStatement() {
	}
	
	public TimedStatement(int bra, Constant<SimpleFloat> start,Constant<SimpleFloat> dur, Constant<SimpleFloat> end, int ket, Statement s) {
		super(bra,start,dur,end,ket);
		this.s = s;
	}
	
	public boolean apply(State p, int contextID, State c) {
		return true;
	}

	public void translateDecl(PDDL pddl, Interval unit) {
		s.translateDecl(pddl,unit);
	}
	
	public void translateStmt(PDDL pddl, Interval unit, PDDL.Time p) {
		// FIXME: see error msg.
		// not sure what that means.  oh well.
		PDDL.Time part = PDDL.getPart(unit,this);
		if (part == null) {
			System.err.println("Haven't implemented non-PDDL time access (yet).");
			part = PDDL.Time.All;
		} else if (part == Time.Timeless) {
			System.err.println("A timeless timed statement.  Intriguing.");
			part = PDDL.Time.All;
			System.err.println(s.toString());
		}
		copyPDDL(unit);
		s.translateStmt(pddl, this, part);
	}

	


}
